package org.raymond.icloud.common.core.constants;

import cn.hutool.core.util.RandomUtil;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
public class CacheConstants {
    // prefix
    public static String PREFIX_TOKEN = "token:";
    public static String PREFIX_CERT = "cert:";
    public static String PREFIX_USER = "user:";

    // key
    public static final String KEY_TOKEN_PREFIX = "bearer ";
    public static final String KEY_TOKEN = "token";

    // time, unit: seconds
    public final static Long TOKEN_EXPIRE_S = 60*60L;
    public final static Long CERT_EXPIRE_S = 60*60L;
    public final static Integer RANDOM_LIMIT = 1000;
    public final static Integer NEAR_TIME = 60;

    private CacheConstants(){}

    public static Long expireTime(Long expire){
        return expire + RandomUtil.randomLong(RANDOM_LIMIT);
    }
}
